<script setup>
import {get} from "@/net/axiosMethod.js";
import {useUserStore} from "@/stores/index.js";
import router from "@/router/index.js";
import {onMounted} from "vue";

const userStore = useUserStore()

onMounted(()=> {
  if (userStore.auth.user === null) {
    get('/api/user/me', (userInfo)=> {
      userStore.auth.user = userInfo
      console.log(userStore.auth.user)
      router.push('/index')
    }, ()=> {
      userStore.auth.user = null
    })
  }
})
</script>

<template>
<router-view/>
</template>

<style scoped>

</style>
